function C57_CPP_Proportion_PlaceCell_Bar_Graph(Placeness_MetaData)
%% Fix bugs
for n = 1:size(Placeness_MetaData,2)
    if Placeness_MetaData(n).PlaceCell_Proportion == 0
        Placeness_MetaData(n).PlaceCell_Proportion = 0.00000000001;
    end
end

%% Step 1: Collect all Data

% C57_5
[C5_s1, C5_s1M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_5', 'saline', 'AM');
[C5_s2, C5_s2M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_5', 'saline', 'day1');
C5_saline = cat(1, C5_s1, C5_s2);
C5_saline_M = cat(1, C5_s1M, C5_s2M);
[C5_cpp1, C5_cpp1_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_5', '(R)_CPP 1mg/kg', 'day1');
[C5_cpp3, C5_cpp3_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_5', '(R)_CPP 3mg/kg', 'day1');
[C5_cpp10, C5_cpp10_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_5', '(R)_CPP 10mg/kg', 'day1');

% C57_6
[C6_s1, C6_s1M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_6', 'saline', 'AM');
[C6_s2, C6_s2M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_6', 'saline', 'day1');
C6_saline = cat(1, C6_s1, C6_s2);
C6_saline_M = cat(1, C6_s1M, C6_s2M);
[C6_cpp1, C6_cpp1_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_6', '(R)_CPP 1mg/kg', 'day1');
[C6_cpp3, C6_cpp3_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_6', '(R)_CPP 3mg/kg', 'day1');
[C6_cpp10, C6_cpp10_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_6', '(R)_CPP 10mg/kg', 'day1');

% C57_7
[C7_s1, C7_s1M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_7', 'saline', 'AM');
[C7_s2, C7_s2M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_7', 'saline', 'day1');
C7_saline = cat(1, C7_s1, C7_s2);
C7_saline_M = cat(1, C7_s1M, C7_s2M);
[C7_cpp1, C7_cpp1_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_7', '(R)_CPP 1mg/kg', 'day1');
[C7_cpp3, C7_cpp3_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_7', '(R)_CPP 3mg/kg', 'day1');
[C7_cpp10, C7_cpp10_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_7', '(R)_CPP 10mg/kg', 'day1');

% C57_8
[C8_s1, C8_s1M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_8', 'saline', 'AM');
[C8_s2, C8_s2M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_8', 'saline', 'day1');
C8_saline = cat(1, C8_s1, C8_s2);
C8_saline_M = cat(1, C8_s1M, C8_s2M);
[C8_cpp1, C8_cpp1_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_8', '(R)_CPP 1mg/kg', 'day1');
[C8_cpp3, C8_cpp3_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_8', '(R)_CPP 3mg/kg', 'day1');
[C8_cpp10, C8_cpp10_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'C57_8', '(R)_CPP 10mg/kg', 'day1');

%% Step2: Organize & Summarize data

% get mean for each genotype under each dose
saline_M = mean(cat(1, C5_saline_M, C6_saline_M, C7_saline_M, C8_saline_M));
cpp1_M = mean(cat(1, C5_cpp1_M, C6_cpp1_M, C7_cpp1_M, C8_cpp1_M));
cpp3_M = mean(cat(1, C5_cpp3_M, C6_cpp3_M, C7_cpp3_M, C8_cpp3_M));
cpp10_M = mean(cat(1, C5_cpp10_M, C6_cpp10_M, C7_cpp10_M, C8_cpp10_M));

% get standard error for each genotype under each dose (from the mean of each animal, not individual experiment)
saline_SE = calculate_standard_error(cat(1, C6_saline_M, C8_saline_M, C7_saline_M, C8_saline_M));
cpp1_SE = calculate_standard_error(cat(1, C6_cpp1_M, C8_cpp1_M, C7_cpp1_M, C8_cpp1_M));
cpp3_SE = calculate_standard_error(cat(1, C6_cpp3_M, C8_cpp3_M, C7_cpp3_M, C8_cpp3_M));
cpp10_SE = calculate_standard_error(cat(1, C6_cpp10_M, C8_cpp10_M, C7_cpp10_M, C8_cpp10_M));

%% Step 3: Plot Data

figure
% plot for WT
A = categorical({'0 (saline)'});
B = categorical({'1'});
C = categorical({'3'});
D = categorical({'10'});
X = cat(2,A,B,C,D);
X = reordercats(X,{'0 (saline)','1','3','10'});
Y = cat(2, saline_M, cpp1_M, cpp3_M, cpp10_M);
bar(X(1,1),Y(1,1),0.2,'LineWidth',1.2,'FaceColor','#2AF598');
% h.CData(1,:) = [0 0 1]; % color up each individual bar
ylabel('Proportion of Place Cell');
xlabel('(R)-CPP Dose (mg/kg)');
hold on
bar(X(1,2),Y(1,2),0.2,'LineWidth',1.2,'FaceColor','#1BD7BB');
hold on
bar(X(1,3),Y(1,3),0.2,'LineWidth',1.2,'FaceColor','#08B3E5');
hold on
bar(X(1,4),Y(1,4),0.2,'LineWidth',1.2,'FaceColor','#003193');
hold on
err(1,1)=saline_SE;
err(1,2)=cpp1_SE;
err(1,3)=cpp3_SE;
err(1,4)=cpp10_SE;
er = errorbar(X,Y,[],err,'LineWidth',2);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
ylim([0,0.5]);
set(gca,'FontSize',20);
hold on

% scatter plots with horizontal offsets - quick & dirty
half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(A,size(C5_saline,1),1),C5_saline(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C6_saline,1),1),C6_saline(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C7_saline,1),1),C7_saline(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C8_saline,1),1),C8_saline(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(B,size(C5_cpp1,1),1),C5_cpp1(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C6_cpp1,1),1),C6_cpp1(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C7_cpp1,1),1),C7_cpp1(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C8_cpp1,1),1),C8_cpp1(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(C,size(C5_cpp3,1),1),C5_cpp3(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C6_cpp3,1),1),C6_cpp3(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C7_cpp3,1),1),C7_cpp3(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C8_cpp3,1),1),C8_cpp3(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(D,size(C5_cpp10,1),1),C5_cpp10(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C6_cpp10,1),1),C6_cpp10(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C7_cpp10,1),1),C7_cpp10(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C8_cpp10,1),1),C8_cpp10(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


end